<?
	require_once('./application/models/activiteitenModel.php');
	
	class kalender_dag
	{
		private $naam;
		private $nummer;
		private $month;
		private $year;
		private $activiteiten;
		private $myModel;
		private $vandaag;
		private $conn;
		
		public function __construct($iDag, $iMonth, $iYear, mysqli $iConn)
		{	
		$this -> conn = $iConn;
			$this -> myModel = activiteitenModel::getInstance($this -> conn);
			$dagen = array('Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag', 'Zondag');
			
			$this -> nummer = $iDag;
			
			if($this -> nummer == date('j')){
				$this -> vandaag = true;
			}
			
			$this -> month = $iMonth;
			$this -> year = $iYear;
			
			$this -> naam = $dagen[$this -> getDagVanDeWeek() - 1];
			
			
			
		}
		
		
		
		public function getMaand(){
		
			return $this -> month;
		
		}
		
		public function getJaar(){
		
			return $this -> year;
		}
		
		public function isVandaag(){
		
			return $this -> vandaag;
		
		}
		
		
		public function getDagVanDeWeek(){
		
			return date('N', mktime(0,0,0,$this -> month, $this -> nummer, $this -> year));
		
		}
		
		public function getNaam(){
		
			return $this -> naam;
		
		}
		
		public function getNummer(){
		
			return $this -> nummer;
		
		}
		
		
		public function getActivities()
		{	
		
			if($this -> nummer < 10){
				$nummer = 0 . $this -> nummer;
			}else{
				$nummer = $this -> nummer;
			}
				
			$this -> activiteiten = $this -> myModel -> getActiviByDate($nummer . '/' . $this -> month . '/' . $this -> year);
			
			
			return $this -> activiteiten;
			
			
			
		
		}		
		
		
		public function hasActivities(){
			if($this -> nummer < 10){
				$nummer = 0 . $this -> nummer;
			}else{
				$nummer = $this -> nummer;
			}
		
			$this -> activiteiten = $this -> myModel -> getActiviByDate($nummer . '/' . $this -> month . '/' . $this -> year);
			return count($this -> activiteiten) > 0 ? true : false;
		}

	}
?>